package cn.datawin.cmppclient.service.impl;

import cn.datawin.bms.provider.entity.ProvProviderEntity;
import cn.datawin.cmppclient.mapper.ProvProviderMapper;
import cn.datawin.cmppclient.service.ProvProviderService;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 上游供应商
 *
 * @author datawin-sms
 * @date 2025-08-20 15:16:04
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class ProvProviderServiceImpl extends ServiceImpl<ProvProviderMapper, ProvProviderEntity> implements ProvProviderService {

	@Override
	public List<ProvProviderEntity> getCmppProviderList() {
		// 从数据库中查询cmpp供应商列表
		List<ProvProviderEntity> cmppProviderList = baseMapper.selectList(new LambdaQueryWrapper<ProvProviderEntity>()
				.in(ProvProviderEntity::getApiProgramId, Arrays.asList(1,2))
				.eq(ProvProviderEntity::getStatus, 1));
		if(CollUtil.isEmpty(cmppProviderList)) return CollUtil.newArrayList();
		return cmppProviderList;
	}
}
